package org.jground.rx.def.apps.crm;
import org.jground.rx.*;
import org.jground.rx.gen.*;
import org.jground.util.*;
import java.util.List;
import org.jground.rx.def.apps.accounting.*;
import org.jground.rx.def.apps.commons.*;
import org.jground.rx.def.apps.knowledge.*;
import org.jground.rx.def.*;
import org.jground.rx.def.apps.cip.*;
import org.jground.rx.def.apps.core.*;
import org.jground.rx.def.apps.legal.*;
import org.jground.rx.def.apps.ipm.*;
@SuppressWarnings("unused")
public class MarketingAction extends GenRoot {

    public static final String moid = "org.jground.rx.def.apps.crm.MarketingAction";

    private static final String title ="title";
    private static final String description ="description";
    private static final String date ="date";
    private static final String budget ="budget";
    private static final String timeNotes ="timeNotes";
    private static final String documents ="documents";
    private static final String receivingCompanies ="receivingCompanies";
    private static final String receivingPersons ="receivingPersons";
    private static final String status ="status";
    private static final String $CREATOR ="$CREATOR";

    public static final class AttName {
        public static final String title ="title";
        public static final String description ="description";
        public static final String date ="date";
        public static final String budget ="budget";
        public static final String timeNotes ="timeNotes";
        public static final String documents ="documents";
        public static final String receivingCompanies ="receivingCompanies";
        public static final String receivingPersons ="receivingPersons";
        public static final String status ="status";
        public static final String $CREATOR ="$CREATOR";
    }

    public static MarketingAction createNew() { return new MarketingAction(RXObjectService.getInstance().create(moid)); }

    public static MarketingAction getById(String oid) { 
        IRXObject mod = RXObjectService.getInstance().getById(oid);
        if(mod == null) { return null; }
        return new MarketingAction(mod);
    }

    public static MarketingAction[] getByIds(String... oids) { 
        List<IRXObject> mods = RXObjectService.getInstance().getByIds(moid, oids);
        MarketingAction[] res = new MarketingAction[mods.size()];
        int i = 0;
        for(IRXObject mod : mods) {
            res[i] = new MarketingAction(mod);
            i++;
        }
        return res;
    }

    public static SearchCriteria newSearchCriteria() {
        return  SearchCriteria.create(moid);
    }

    public static MarketingAction[] search(SearchCriteria sc) {
        return  wrap(GenRoot._search(sc));
    }

    public static MarketingAction[] wrap(List<? extends IRXObjectSynopsis> mods) { 
        MarketingAction[] res = new MarketingAction[mods.size()];
        int i = 0;
        for(IRXObjectSynopsis mod : mods) {
            res[i] = new MarketingAction(mod);
            i++;
        }
        return res;
    }

    public static MarketingAction wrap(IRXObjectSynopsis mod) { 
        return new MarketingAction(mod);
    }

    private MarketingAction(IRXObjectSynopsis rxObject) {this.rxObject = (IRXObject) rxObject;}

    public static String getTitleLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, title).getLabel();
    }

    public static String getTitleDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, title).getDescription();
    }

    public void setTitle(String string) {
        rxObject.set(title, _to_String(string));
    }

    public String getTitle() {
        return _to_String(rxObject.getCurrentValue(title));
    }

    public static String getDescriptionLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, description).getLabel();
    }

    public static String getDescriptionDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, description).getDescription();
    }

    public void setDescription(String text) {
        rxObject.set(description, _to_String(text));
    }

    public String getDescription() {
        return _to_String(rxObject.getCurrentValue(description));
    }

    public static String getDateLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, date).getLabel();
    }

    public static String getDateDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, date).getDescription();
    }

    public void setDate(String dateValue) {
        rxObject.set(date, _to_String(dateValue));
    }

    public String getDate() {
        return _to_String(rxObject.getCurrentValue(date));
    }

    public static String getBudgetLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, budget).getLabel();
    }

    public static String getBudgetDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, budget).getDescription();
    }

    public void setBudget(Currency currency) {
        rxObject.set(budget, _to_String(currency));
    }

    public Currency getBudget() {
        return _to_Currency(rxObject.getValues(budget));
    }

    public static String getTimeNotesLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, timeNotes).getLabel();
    }

    public static String getTimeNotesDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, timeNotes).getDescription();
    }

    public int getTimeNotesSize() {
        return org.jground.rx.def.apps.commons.TimeNote.wrap(rxObject.getComponents(AttName.timeNotes)).length;
    }

    public org.jground.rx.def.apps.commons.TimeNote[] getTimeNotes() {
        return org.jground.rx.def.apps.commons.TimeNote.wrap(rxObject.getComponents(AttName.timeNotes));
    }

    public org.jground.rx.def.apps.commons.TimeNote getTimeNotes(int index) {
        return org.jground.rx.def.apps.commons.TimeNote.wrap(rxObject.getComponents(AttName.timeNotes))[index];
    }

    public org.jground.rx.def.apps.commons.TimeNote createTimeNotes() {
        return org.jground.rx.def.apps.commons.TimeNote.wrap(rxObject.newComponent(timeNotes));
    }

    public void setTimeNotes(org.jground.rx.def.apps.commons.TimeNote[] values) {
        rxObject.set(timeNotes, _to_String(timeNotes));
    }

    public void addTimeNotes(org.jground.rx.def.apps.commons.TimeNote value) {
        rxObject.add(timeNotes, value.getOidString());
    }

    public static String getDocumentsLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, documents).getLabel();
    }

    public static String getDocumentsDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, documents).getDescription();
    }

    public int getDocumentsSize() {
        return org.jground.rx.def.apps.commons.Document.wrap(rxObject.getComponents(AttName.documents)).length;
    }

    public org.jground.rx.def.apps.commons.Document[] getDocuments() {
        return org.jground.rx.def.apps.commons.Document.wrap(rxObject.getComponents(AttName.documents));
    }

    public org.jground.rx.def.apps.commons.Document getDocuments(int index) {
        return org.jground.rx.def.apps.commons.Document.wrap(rxObject.getComponents(AttName.documents))[index];
    }

    public org.jground.rx.def.apps.commons.Document createDocuments() {
        return org.jground.rx.def.apps.commons.Document.wrap(rxObject.newComponent(documents));
    }

    public void setDocuments(org.jground.rx.def.apps.commons.Document[] values) {
        rxObject.set(documents, _to_String(documents));
    }

    public void addDocuments(org.jground.rx.def.apps.commons.Document value) {
        rxObject.add(documents, value.getOidString());
    }

    public static String getReceivingCompaniesLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, receivingCompanies).getLabel();
    }

    public static String getReceivingCompaniesDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, receivingCompanies).getDescription();
    }

    public void addReceivingCompanies(org.jground.rx.def.apps.core.Institution... value) {
        rxObject.set(receivingCompanies, _to_String(value));
    }

    public void setReceivingCompanies(org.jground.rx.def.apps.core.Institution[] values) {
        rxObject.set(receivingCompanies, _to_String(values));
    }

    public int getReceivingCompaniesSize() {
        return StringUtils.rnn(rxObject.getValues(receivingCompanies)).length;
    }

    public org.jground.rx.def.apps.core.Institution[] getReceivingCompanies() {
        return org.jground.rx.def.apps.core.Institution.getByIds(rxObject.getValues(receivingCompanies));
    }

    public org.jground.rx.def.apps.core.Institution getReceivingCompanies(int index) {
        return org.jground.rx.def.apps.core.Institution.getByIds(rxObject.getValues(receivingCompanies))[index];
    }

    public static String getReceivingPersonsLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, receivingPersons).getLabel();
    }

    public static String getReceivingPersonsDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, receivingPersons).getDescription();
    }

    public void addReceivingPersons(org.jground.rx.def.apps.core.Person... value) {
        rxObject.set(receivingPersons, _to_String(value));
    }

    public void setReceivingPersons(org.jground.rx.def.apps.core.Person[] values) {
        rxObject.set(receivingPersons, _to_String(values));
    }

    public int getReceivingPersonsSize() {
        return StringUtils.rnn(rxObject.getValues(receivingPersons)).length;
    }

    public org.jground.rx.def.apps.core.Person[] getReceivingPersons() {
        return org.jground.rx.def.apps.core.Person.getByIds(rxObject.getValues(receivingPersons));
    }

    public org.jground.rx.def.apps.core.Person getReceivingPersons(int index) {
        return org.jground.rx.def.apps.core.Person.getByIds(rxObject.getValues(receivingPersons))[index];
    }

    public static String getStatusLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, status).getLabel();
    }

    public static String getStatusDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, status).getDescription();
    }

    public void setStatus(String codeValue) {
        rxObject.set(status, _to_String(codeValue));
    }

    public String getStatus() {
        return _to_String(rxObject.getCurrentValue(status));
    }

    public static String get$CREATORLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, $CREATOR).getLabel();
    }

    public static String get$CREATORDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, $CREATOR).getDescription();
    }

    public void set$CREATOR(String string) {
        rxObject.set($CREATOR, _to_String(string));
    }

    public String get$CREATOR() {
        return _to_String(rxObject.getCurrentValue($CREATOR));
    }

}
